LGF_RoundByPrecision (FC / 1.0.0)

Overview

Author: Siemens Digital Industry

Short description

This function rounds a floating-point number (LReal) to a specified number of decimal places.

Block Interface

LGF_RoundByPrecision (FC)
LReal  number Ret_Val  LReal
    
UInt  precisionDecimal   
    
   

Input parameter

IdentifierData type Description
numberLReal Value to be rounded
precisionDecimalUInt Number of decimal places to round the number (1,2,3)

Output parameter

IdentifierData type Description
Ret_ValLReal Number rounded with the number of decimal places selected

Functional description

This function rounds a floating-point number (LReal) to a specified number of decimal places.
It scales the value, truncates it to an integer, and then re-scales it to produce the rounded result.

Change log

Version & DateChange description
1.0.0Siemens Industry Online Support
30.07.2025First released version